# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'form1.ui'
#
# Created: Sun May 4 23:34:18 2008
#      by: The PyQt User Interface Compiler (pyuic) 3.17.4
#
# WARNING! All changes made in this file will be lost!


from qt import *


class utnCPM(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("utnCPM")



        self.tabWidget2 = QTabWidget(self,"tabWidget2")
        self.tabWidget2.setEnabled(1)
        self.tabWidget2.setGeometry(QRect(0,0,530,540))
        self.tabWidget2.setSizePolicy(QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum,0,0,self.tabWidget2.sizePolicy().hasHeightForWidth()))

        self.tab = QWidget(self.tabWidget2,"tab")

        self.textLabel1_2 = QLabel(self.tab,"textLabel1_2")
        self.textLabel1_2.setGeometry(QRect(150,10,60,31))

        self.textLabel1_3 = QLabel(self.tab,"textLabel1_3")
        self.textLabel1_3.setGeometry(QRect(270,10,130,31))

        self.textLabel1 = QLabel(self.tab,"textLabel1")
        self.textLabel1.setGeometry(QRect(10,10,100,31))

        self.lbPrecedences = QListBox(self.tab,"lbPrecedences")
        self.lbPrecedences.setGeometry(QRect(270,40,150,250))

        self.leJob = QLineEdit(self.tab,"leJob")
        self.leJob.setGeometry(QRect(10,299,130,23))

        self.lePrecedence = QLineEdit(self.tab,"lePrecedence")
        self.lePrecedence.setGeometry(QRect(270,300,150,22))

        self.btLimpiar = QPushButton(self.tab,"btLimpiar")
        self.btLimpiar.setGeometry(QRect(430,40,80,31))
        self.btLimpiar.setAutoDefault(0)

        self.btAdd = QPushButton(self.tab,"btAdd")
        self.btAdd.setGeometry(QRect(430,296,80,30))
        self.btAdd.setAutoDefault(0)

        self.leDuration = QLineEdit(self.tab,"leDuration")
        self.leDuration.setGeometry(QRect(150,299,100,23))

        self.lbJobs = QListBox(self.tab,"lbJobs")
        self.lbJobs.setGeometry(QRect(10,40,130,250))

        self.txtError = QLabel(self.tab,"txtError")
        self.txtError.setGeometry(QRect(11,360,500,130))

        self.lbDurations = QListBox(self.tab,"lbDurations")
        self.lbDurations.setGeometry(QRect(150,40,100,250))
        self.tabWidget2.insertTab(self.tab,QString.fromLatin1(""))

        self.tab_2 = QWidget(self.tabWidget2,"tab_2")

        self.pushButton3 = QPushButton(self.tab_2,"pushButton3")
        self.pushButton3.setEnabled(1)
        self.pushButton3.setGeometry(QRect(-11,0,540,21))

        self.pixmapImagen = QLabel(self.tab_2,"pixmapImagen")
        self.pixmapImagen.setEnabled(1)
        self.pixmapImagen.setGeometry(QRect(0,30,530,480))
        self.pixmapImagen.setScaledContents(1)
        self.tabWidget2.insertTab(self.tab_2,QString.fromLatin1(""))

        self.languageChange()

        self.resize(QSize(532,540).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.btLimpiar,SIGNAL("clicked()"),self.lbJobs.clear)
        self.connect(self.btAdd,SIGNAL("clicked()"),self.addJob)
        self.connect(self.lePrecedence,SIGNAL("returnPressed()"),self.addJob)
        self.connect(self.btLimpiar,SIGNAL("clicked()"),self.lbPrecedences.clear)
        self.connect(self.btLimpiar,SIGNAL("clicked()"),self.lbDurations.clear)
        self.connect(self.leDuration,SIGNAL("returnPressed()"),self.addJob)
        self.connect(self.leJob,SIGNAL("returnPressed()"),self.addJob)
        self.connect(self.pushButton3,SIGNAL("clicked()"),self.generarDiagrama)

        self.setTabOrder(self.leJob,self.leDuration)
        self.setTabOrder(self.leDuration,self.lePrecedence)
        self.setTabOrder(self.lePrecedence,self.btAdd)
        self.setTabOrder(self.btAdd,self.lbJobs)
        self.setTabOrder(self.lbJobs,self.lbDurations)
        self.setTabOrder(self.lbDurations,self.lbPrecedences)
        self.setTabOrder(self.lbPrecedences,self.tabWidget2)
        self.setTabOrder(self.tabWidget2,self.btLimpiar)


    def languageChange(self):
        self.setCaption(self.__tr("utnCPM"))
        self.textLabel1_2.setText(self.__trUtf8("\x44\x75\x72\x61\x63\x69\xc3\xb3\x6e"))
        self.textLabel1_3.setText(self.__tr("Precedencias"))
        self.textLabel1.setText(self.__tr("Nombre tarea"))
        self.lePrecedence.setText(self.__tr("-"))
        self.btLimpiar.setText(self.__tr("Limpiar"))
        self.btAdd.setText(self.__tr("Agregar"))
        self.txtError.setText(QString.null)
        self.tabWidget2.changeTab(self.tab,self.__tr("Cargar datos"))
        self.pushButton3.setText(self.__tr("Generar diagrama"))
        self.pixmapImagen.setText(QString.null)
        self.tabWidget2.changeTab(self.tab_2,self.__tr("Diagrama"))


    def addJob(self):
            import acciones
            resultado = acciones.addJob(
        	    self,
        	    self.leJob.text().ascii(),
        	    self.leDuration.text().ascii() ,
        	    self.lePrecedence.text().ascii(),
        	    self.txtError
        	    )    
            if resultado:
                # limpiamos
                self.leJob.clear()
        	self.leDuration.clear()
        	self.lePrecedence.setText('-')
        	self.leJob.setFocus()
        

    def Form1_destroyed(self,a0):
        print "utnCPM.Form1_destroyed(QObject*): Not implemented yet"

    def generarDiagrama(self):
            import acciones
            acciones.generarDiagrama(self)    
        

    def __tr(self,s,c = None):
        return qApp.translate("utnCPM",s,c)

    def __trUtf8(self,s,c = None):
        return qApp.translate("utnCPM",s,c,QApplication.UnicodeUTF8)
